package com.ontology.util.parser.content;
import java.util.List;

import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;

import com.ontology.util.ODataType;
import com.ontology.util.model.OColumn;
import com.ontology.util.model.ORow;
import com.ontology.util.model.impl.OntologyColumn;
import com.ontology.util.model.impl.OntologyRow;
public class ExcelRowParser extends AbstractLineParser<Row> {
	public ORow parseLine(Row content, List<OColumn> columns) {
		
		OntologyRow row = new OntologyRow();
		
		for (int cIndex = 0; cIndex < columns.size(); cIndex++) {
			OntologyColumn ontologyColumn = (OntologyColumn) columns.get(cIndex);
			Cell cell = content.getCell(cIndex);
			
			if(ontologyColumn.getType() == null){
			int cellType = cell.getCellType();
			switch(cellType){
				case Cell.CELL_TYPE_NUMERIC:
					
					Double value= cell.getNumericCellValue();
					
					ontologyColumn.setType(ODataType.LONG);
					
					break;
				case Cell.CELL_TYPE_BLANK:
					break;
				case Cell.CELL_TYPE_BOOLEAN:
					break;
				case Cell.CELL_TYPE_ERROR:
					break;	
				case Cell.CELL_TYPE_FORMULA:
					break;	
				case Cell.CELL_TYPE_STRING:
					break;
				
			  }
			}
			

		}
		return row;
	}
}
